
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class RoutePage extends StatelessWidget{

  @override
  Widget build(BuildContext context) {

    return new MaterialApp(
      title: 'aaa',
      home: new Page1(),
    );
  }
}

class Page1 extends StatelessWidget{

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('page1'),
      ),
      body: new Center(
          child: new RaisedButton(onPressed: (){
            Navigator.push(context, new MaterialPageRoute(builder: (context)=>new Page2()));
          },
          child: new Text('Launch page2'),)
      ),
    );
  }
}

class Page2 extends StatelessWidget{

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('page2'),
      ),
      body: new Center(
          child: new RaisedButton(onPressed: (){
            Navigator.pop(context);
          },
          child: new Text('Go back'),)
      ),
    );
  }
}